﻿
// Copyright © 2009 Mehdi Golchin. All rights reserved.

namespace TinyMceWrapper
{

    #region [ Imports ]

    using System.Web.UI;

    #endregion

    public static class StateBagExtensions
    {

        #region [ Extension Methods ]

        public static T GetValue<T>(this StateBag source, string name, T defaultValue)
        {
            object value = source[name];
            return value != null ? (T)value : defaultValue;
        }

        public static void SetValue<T>(this StateBag source, string name, T value)
        {
            source[name] = value;
        }

        #endregion

    }

}
